$def with (announcement, cookie_name, cookie_duration_days=30)

$# Renders a dismissible banner element containing the given announcement.
$# If the patron has dismissed the banner in the past, the banner will not
$# be rendered.
$#
$# announcement (str) -- Rendered content that will be displayed in the banner
$# cookie_name (str) -- identifier for the banner. If the user dismisses the banner, a cookie with this name is set
$# cookie_duration_days (int) -- TTL before cookie expires in days

$ hide_banner = cookies().get(cookie_name)

$if not hide_banner:
    <div data-cookie-name="$cookie_name" data-cookie-duration-days="$cookie_duration_days" class="page-banner--dismissable">
        <span class="page-banner--dismissable-content">$:announcement</span>
        <button class="page-banner--dismissable-close">X</button>
    </div>
